<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<style>
  * {
	font-family: Helvetica;
  }
</style>
</HEAD>

<BODY>
<div style="margin:10px;">
	<div style="font-size:50px;font-weight:bold;">
	  <span style="color:#548DD4">CARS</span><span style="color:#C2C2C4">FOR</span><span style="color:#548DD4">DEALERS</span>
	</div>

<table style="width:700px;">
  <tr>
    <td style="width:100px;height:130px;background-color:#E4E4E6;font-size:12px;padding:10px;color:#666666;" valign="bottom">
	  <?= date ("M d, Y", strtotime($this->invoice->stamp)); ?><BR><br>
	  Invoice No.<?= $this->invoice->id ?>
    </td>
    <td style="background-color:#BFBFBF;color:white;padding:10px;" align="right" valign="middle">
	
	  <div style="font-size:39px;">INVOICE</div>
	  <div>Prepared for Cars For Dealers</div>
	  <div><?= $this->user->dealership_name ?> - <?= $this->user->vat_number ?></div>
	</td>
  </tr>
</table>
<style>
.head-data
{
  background-color:#F1F1F2;
  font-size:10px;
  padding:10px;
  color:#7e8076;
}
</style>
<br>
<table style="width:700px;border: 1px solid #F1F1F2;" cellspacing=0 cellpadding=0>
  <tr>
    <td class="head-data">DESCRIPTION OF WORK</td>
    <td class="head-data" align="right">QTY/HRS</td>
    <td class="head-data" align="right">UNIT PRICE</td>
    <td class="head-data" align="right">SUB TOTAL</td>
  </tr>
<? if ($this->invoice->type == 'bulk-credit'): ?>
  <tr style="color:#7e8076;font-size:14px;">
    <td style="padding:6px;height:400px;" valign="top">Bulk credit purchase</td>
    <td style="padding:6px;border-right: 1px solid #F1F1F2;border-left: 1px solid #F1F1F2;" align="right" valign="top"><?= $this->invoice->bulk_credit ?></td>
    <td style="padding:6px;" align="right" valign="top">&pound;<?= number_format($this->invoice->price/$this->invoice->bulk_credit, 2) ?></td>
    <td style="padding:6px;border-left: 1px solid #F1F1F2;" align="right" valign="top">&pound;<?= number_format($this->invoice->price, 2) ?></td>
  </tr>
<? endif; ?>
<? if ($this->invoice->type == 'valuations'): ?>
  <tr style="color:#7e8076;font-size:14px;">
    <td style="padding:6px;height:400px;" valign="top">Lead purchase</td>
    <td style="padding:6px;border-right: 1px solid #F1F1F2;border-left: 1px solid #F1F1F2;" align="right" valign="top"><?= count($this->invoice->getValuations()) ?></td>
    <td style="padding:6px;" align="right" valign="top">&pound;<?= number_format($this->invoice->price/count($this->invoice->getValuations()), 2) ?></td>
    <td style="padding:6px;border-left: 1px solid #F1F1F2;" align="right" valign="top">&pound;<?= number_format($this->invoice->price, 2) ?></td>
  </tr>
<? endif; ?>
  <tr style="color:#7e8076;font-size:13px;">
    <td style="height:30px;border-right:1px solid #F1F1F2; border-top: 2px solid #F1F1F2;"></td>
    <td style="border-right:1px solid #F1F1F2; border-top: 2px solid #F1F1F2;"></td>
    <td align="right" style="padding-right:6px;font-weight:bold; background-color:#E4E4E6; border-right:1px solid #F1F1F2; border-top: 2px solid #F1F1F2;">GRAND TOTAL</td>
    <td align="right" style="padding-right:6px;font-weight:bold; background-color:#E4E4E6; color:#7e8076;border-right:1px solid #F1F1F2; border-top: 2px solid #F1F1F2;">&pound;<?= number_format($this->invoice->price, 2) ?></td>
  </tr>
</table>
<br>
<br>
<br>
<div style="width:300px;border:1px solid #F1F1F2;font-size:10px;padding:10px;">

<div style="color:#7e8076">PAYMENT TERMS</div>
<div>To be made payable to First name, Last name</div>
<br>
<br>
<br>
<div style="color:#7e8076">ADDRESS</div>
<div>123 Main Street - Boulder, CO - 80026</div>
<div>
</div>


</div>

</HTML>
